import request from '@/utils/request';

/**
 * 添加活动信息
 * @param {Array} param.carouselIdList 轮播图id
 * @param {String}param.context        详细内容
 * @param {Array} param.productIdList  商品id
 * @param {String}param.title          标题
 * @param {String}param.titlePictureId 标题图片
 */
export function AddActivityInfo(param) {
    return request({
        url: '/information/add',
        method: 'post',
        data: {
            carouselIdList: param.carouselIdList,
            context: param.context,
            productIdList: param.productIdList,
            title: param.title,
            titlePictureId: param.titlePictureId
        }
    })
}

/**
 * 获取活动信息
 * @param {number} param.currPage 当前页
 * @param {number} param.pageSize 页容
 * @param {number} param.searchText 搜索关键字
 */
export function GetActivityInfo(param) {
    return request({
        url: '/information/query',
        method: 'post',
        data: {
            currPage: param.currPage,
            pageSize: param.pageSize,
            searchText: param.searchText
        }
    })
}

/**
 * 修改活动信息
 * @param {*} id 活动id
 * @returns 
 */
export function SetActivityInfo(param) {
    return request({
        url: '/information/update',
        method: 'post',
        data: {
            id: param.id,
            carouselIdList: param.carouselIdList,
            context: param.context,
            productIdList: param.productIdList,
            title: param.title,
            titlePictureId: param.titlePictureId
        }
    })
}

/**
 * 删除活动信息
 * @param {number} id 活动信息id
 */
export function DeleteActivityInfo(id) {
    return request({
        url: '/information/delete',
        method: 'post',
        data: {
            id
        }
    })
}